package io.renren.modules.question.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.question.entity.QuestionMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author liangbaigao
 * @Date 2022/10/6 19:18
 */
@Mapper
public interface QuestionMessageMapper extends BaseMapper<QuestionMessage> {

    /**
     * 查询全部数据
     * @return
     */
    @Select("SELECT id,question_name,state from question_message")
    List<QuestionMessage> selectAll();

    /**
     * 根据创建用户查问卷
     * @param id
     * @return
     */
    @Select("SELECT id,question_name,state from question_message WHERE create_user = #{userId}}")
    List<QuestionMessage> selectByUser(@Param("userId")Long id);
}
